package com.blockchainenergy.security.login.impl;

import com.blockchainenergy.security.login.Login;
import com.blockchainenergy.security.login.LoginDto;
import com.blockchainenergy.security.login.LoginService;
import com.blockchainenergy.security.login.dao.LoginDao;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @descriptions:
 * @data: 2021/10/23 12:40
 */
@Service
@Transactional
public class LoginServiceImpl implements LoginService {
    @Resource
    private LoginDao loginDao;

    @Override
    public int checkValid(LoginDto dto) {
        // 查公钥是否存在
        if (loginDao.countUserId(dto) == 0) {
            return -1;
        }
        return 0;
    }

    @Override
    public Login getLogin(String u_id) {
        return loginDao.getUserInfoByUId(u_id);
    }
}
